﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for Article_BU
/// </summary>
public class Article_BU
{
    ArticleDAL arDAL = new ArticleDAL();
    public int Update_Article_BU(int article_id, int user_id, string article_name, string article_sumary, string article_des, string image, int category_id, int topic_id)
    {
        Article ar = new Article();
        ar.article_id = article_id;
        ar.user_id = user_id;
        ar.article_name = article_name;
        ar.article_sumary = article_sumary;
        ar.article_des = article_des;
        ar.image = image;
        ar.category_id = category_id;
        ar.topic_id = topic_id;
        return arDAL.Update_Article_DAL(ar);
    }

    public int Update_Article_BU(int user_id, string article_name, string article_sumary, string article_des, string image, int category_id, int topic_id)
    {
        Article art = new Article();
        art.user_id = user_id;
        art.article_name = article_name;
        art.article_sumary = article_sumary;
        art.article_des = article_des;
        art.image = image;
        art.category_id = category_id;
        art.topic_id = topic_id;
        return arDAL.Insert_Article_DAL(art);
    }

    public DataTable Get_All_Article() 
    {
        return arDAL.Get_All_Article();
    }

    public DataTable Get_Article_By_Id_Category_BU(int Id_Category) {
        Article art = new Article();
        art.category_id = Id_Category;
        return arDAL.Get_Article_By_Id_Category_DAL(art);
    }

    public DataTable Get_Article_By_Id_BU(int Id_Article)
    {
        Article art = new Article();
        art.category_id = Id_Article;
        return arDAL.Get_Article_By_Id_DAL(art);
    }
}